<!-- 组合式api的使用 -->
<template>
  count是{{ count }}
  <p></p>
  计算出count的3倍是{{ threeCount }}
  <p></p>
  <p></p>

</template>


<script setup lang="ts">
import { ref,computed,watch,onMounted,onUpdated,onUnmounted} from "vue";

let count = ref(4)
count.value ++

let threeCount = computed(()=>{
  return count.value * 3
})

watch(count,(newValue,oldValue)=>{
  console.log("原来count的值是%s,修改后的值是%s",oldValue,newValue)
})

onMounted(() => {
  console.log('组件已挂载')
})

onUpdated(() => {
  console.log('组件已更新')
})

onUnmounted(() => {
  console.log('组件已卸载')
})




</script>

